package fx.com;

import fx.com.controller.LoginController;
import fx.com.controller.MainController;
import fx.com.entity.User;
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.util.Duration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.io.IOException;
import java.util.List;

@SpringBootApplication
public class FxDemoApplication extends Application{

    private static ApplicationContext applicationContext;

    public static void main(String[] args) {
        applicationContext = SpringApplication.run(FxDemoApplication.class, args);
        launch(args);
    }


    @Override
    public void start(Stage primaryStage) throws IOException {

        primaryStage.setTitle("javaFX");
        primaryStage.setScene(new Scene(root(), 500, 300));
        primaryStage.setResizable(false);
        primaryStage.show();
    }


    public Parent root() throws IOException {

        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("/sample.fxml"));
        loader.setControllerFactory(applicationContext::getBean);
        return loader.load();
    }

}

